package com.duobaoyu.dby.supply.common.biz.remote.dto.order;

import com.duobaoyu.dby.supply.common.biz.remote.dto.area.ConsigneeInfo;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;

import javax.validation.Valid;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotEmpty;
import javax.validation.constraints.NotNull;
import java.io.Serializable;
import java.math.BigDecimal;
import java.util.List;

/**
 * 提交订单
 *
 * @author fengshaoyu
 * @version 1.0.0
 * @date 2023/10/7 9:44
 */
@Data
@Builder
@AllArgsConstructor
@NoArgsConstructor
public class SubmitOrderDTO implements Serializable {
	private static final long serialVersionUID = -3286331553203245069L;

	@NotBlank(message = "访问来源不能为空")
	@ApiModelProperty("访问来源")
	private String showServerName;

	@ApiModelProperty("订单备注")
	private String orderRemark;

	@NotBlank(message = "业务交易号不能为空")
	@ApiModelProperty(name = "bizTradeSn", value = "业务交易号")
	private String bizTradeSn;

	@NotBlank(message = "商户id不能为空")
	@ApiModelProperty(name = "mchId", value = "商户id")
	private String mchId;

	@ApiModelProperty(name = "userId", value = "用户id")
	private String userId;

	@ApiModelProperty("地址信息")
	private ConsigneeInfo consigneeInfo;

	@ApiModelProperty(name = "electricityFeesParam", value = "电费信息")
	private ElectricityFeesInfo electricityFeesInfo;

	@ApiModelProperty(name = "recipientInfo", value = "收货信息")
	private RecipientInfo recipientInfo;

	@ApiModelProperty(name = "rechargeAccount", value = "充值账号")
	private String rechargeAccount;

	@Valid
	@NotEmpty(message = "商品信息不能为空")
	@ApiModelProperty(name = "skuInfos", value = "商品信息")
	private List<SkuInfo> skuInfos;


	@Data
	@Builder
	@AllArgsConstructor
	@NoArgsConstructor
	public static class SkuInfo {

		@NotBlank(message = "SKU编号不能为空")
		@ApiModelProperty("SKU编号")
		private String skuCode;

		@NotNull(message = "购买数量不能为空")
		@ApiModelProperty("SKU数量")
		private Integer skuNum;

		@NotNull(message = "平台售卖价不能为空")
		@ApiModelProperty(name = "platformSellPrice", value = "商户售卖价")
		private BigDecimal platformSellPrice;

		@ApiModelProperty("地址信息")
		private ConsigneeInfo consigneeInfo;

		@ApiModelProperty(name = "electricityFeesParam", value = "电费信息")
		private ElectricityFeesInfo electricityFeesInfo;

		@ApiModelProperty("地址信息 如果为空,则以外部主信息为主")
		private RecipientInfo recipientInfo;

		@ApiModelProperty("充值账号")
		private String rechargeAccount;
	}
}
